<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('成品列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>单品号:</label>
                            <input type="text" name="itemNo"/>
                        </li>
                        <li>
                            <label>产品编号:</label>
                            <input type="text" name="field"/>
                        </li>
                        <li>
                            <label>产品名称:</label>
                            <input type="text" name="productName"/>
                        </li>
                        <li>
                            <label>EPC:</label>
                            <input type="text" name="epc"/>
                        </li>
                        <li>
                            <label>TID:</label>
                            <input type="text" name="tid"/>
                        </li>
                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:iteminfo:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:iteminfo:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:iteminfo:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
           <a class="btn btn-warning" onclick="" shiro:hasPermission="system:iteminfo:export">
                <i class="fa fa-download"></i> 打印条码
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var detailFlag = [[${@permission.hasPermi('system:iteminfo:detail')}]];
    var prefix = ctx + "system/iteminfo";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            detailUrl: prefix + "/detail/{id}",
            rfiddetailUrl: prefix + "/rfiddetail/{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "成品",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '序号',
                    visible: false
                },
                {
                    field: 'itemNo',
                    title: '单品号'
                },
                {
                    field: 'field',
                    title: '产品编号'
                },
                {
                    field: 'productName',
                    title: '产品名称'
                },
                {
                    field: 'epc',
                    title: 'EPC'
                },
                {
                    field: 'tid',
                    title: 'TID'
                },
                {
                    field: 'locationType',
                    title: '位置类别'
                },
                {
                    field: 'longitudeLatitude',
                    title: '经纬度值'
                },
                {
                    field: 'documentNo',
                    title: '单据号'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'createBy',
                    title: '操作人员'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
        /*                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');*/
                        actions.push('<a class="btn btn-danger btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="rfidDetail(\'' + row.id + '\')"><i class="fa fa-search"></i>RFID数据明细</a>');
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>查看</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });



   function rfidDetail(id, width, height) {
        table.set();
        var _url =  table.options.rfiddetailUrl.replace("{id}", id);
        var _width = $.common.isEmpty(width) ? "800" : width;
        var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height;
        //如果是移动端，就使用自适应大小弹窗
        if ($.common.isMobile()) {
            _width = 'auto';
            _height = 'auto';
        }
        var options = {
            title:  "RFID数据明细",
            width: _width,
            height: _height,
            url: _url,
            skin: 'layui-layer-gray',
            btn: ['关闭'],
            yes: function (index, layero) {
                layer.close(index);
            }
        };
        $.modal.openOptions(options);
    }
</script>
</body>
</html>